package points.dao.impl;

import Admin.entity.Admin;
import points.dao.BaseDao;
import points.dao.PointsDao;
import points.entity.Points;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

/**
 * @author chenle
 * @version 1.0
 * @date 2023/9/27 20:12
 */
public class PointsDaoImpl extends BaseDao implements PointsDao {
    @Override
    public List<Points> getlist() {
        String sql="SELECT * FROM points";
        ResultSet rs=this.executeQuery(sql);
        List<Points> list=new ArrayList<>();
        try {
            while (rs.next()){
                list.add(new Points(
                        rs.getInt(1),
                        rs.getString(2),
                        rs.getInt(3),
                        rs.getInt(4),
                        rs.getInt(5)));
            }
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }finally {
            this.closeConnection(null,null,rs);
        }
        return list;
    }
}
